<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <title>New Task</title>
	<link rel="shortcut icon" href="images/tasks.ico">

    <script type="text/javascript" src="jquery/jquery-1.6.4.min.js"></script>

    <link href="assets/css/bootstrap.css" rel="stylesheet">
    <link href="assets/css/bootstrap-responsive.css" rel="stylesheet">

    <style>
        body {
            padding-top: 10px;
            padding-bottom: 40px; 
            margin-left: 50px;
            margin-right: 50px;
        }
        .sidebar-nav {
            padding: 9px 0;
        }
        .heading {font-weight:bold;}
    </style>
    <script>
        $(document).ready(function() {
            document.getElementById("txtTask").focus();
        });
        
        function save() {
            var txtTask = document.getElementById("txtTask");
            if(txtTask.value != "") {
                document.getElementById("frm").submit();
            } else {
                alert('Cannot save task without description !');
                document.getElementById("txtTask").focus();
                return false;
            }            
        }
    </script>
    <body>
<?php
    session_start();
    if (isset($_SESSION['userid'])) {
?>
        <div  class="container-fluid">
            <div class="row-fluid">
                <div class="span12">
                    <table width="100%" border="0">
                        <tbody>
                            <tr>
                                <td align="left">
                                
                                </td>
                                <td align="center" class="text-error"><strong>New Task</strong></td>
                                <td align="right">
                                
                                </td>
                            </tr>
                        </tbody>
                    </table>            
                </div>
            </div>
            <div class="row-fluid">
                <div class="span12">
                    <form id="frm" name="frm" action="savetask.php" method="POST" >
                        <input type="hidden" id="operation" name="operation" value="insert">
                        <input type="hidden" id="userid" name="userid" value="<?php echo $_SESSION['userid']?>">
                        
                        <label class="control-label heading" for="txtTask"><abbr title="Task Description">Task Description</abbr></label>
                        <div class="controls">
                            <textarea style="width:100%;" id="txtTask" name="txtTask" rows="5"></textarea>
                        </div>

                        <table class="table-condensed">
                            <tbody>
                                <tr>
                                    <td>
                                        <div class="control-group">
                                            <label class="control-label heading" for="selType"><abbr title="Task Type">Type</abbr></label>
                                            <div class="controls">
                                                <select id="selType" name="selType">
                                                    <option>Bug</option>
                                                    <option>Enhancement</option>
                                                    <option>Meeting</option>
                                                    <option>Other</option>
                                                </select>
                                            </div>
                                        </div>
                                    </td>
                                    <td>
                                        <div class="control-group">
                                            <label class="control-label heading" for="selStatus"><abbr title="Task Status">Status</abbr></label>
                                            <div class="controls">
                                                <select id="selStatus" name="selStatus">
                                                    <option>Assigned</option>
                                                    <option>In-progress</option>
                                                    <option>Done</option>
													<option>Inactive</option>
                                                </select>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

                        <div class="control-group" style="padding-top: 10px;">
                            <div class="controls">
                                <button type="button" class="btn btn-primary" onclick="save()"><i class="icon-envelope"></i>&nbsp;&nbsp; Save &nbsp;</button>
                                <a class="btn btn-link" href="home.php"><i class="icon-plus-sign"></i>&nbsp;&nbsp; Cancel &nbsp;</a>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>

<?php
    } else {
        header("location: login.php");
    }
?>
    </body>
</html>